package com.gettec.lims.client.control;

import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.Window;
import com.gettec.lims.client.NlimsConstants;
import com.gettec.lims.client.forms.RegSheetForm;
import com.gettec.lims.client.services.NnimsServiceAsync;
import com.gettec.lims.client.window.RegSheetWindow;
import com.gettec.lims.shared.model.RegSheet;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class RegSheetCTR {
	public static void showWindow(int wincode) {
	
		switch (wincode) {
		case 542748636://打开总管理页面
			createRegSheetWindow();
			return;
		case -1029115792:
			RegSheetForm rsf=new RegSheetForm();
			Window tmpw=new Window();
			tmpw.setAutoHeight(true);
			tmpw.setAutoWidth(true);
			tmpw.add(rsf);
			tmpw.show();
		return;
		}
		return;
	}
	
	static private void createRegSheetWindow() {  
	       // final Window newFeedWindow = new FeedWindow(new Feed());  
	       // newFeedWindow.show();  
	        final NnimsServiceAsync feedService =  
	        	Registry.get(NlimsConstants.SERVICE);  
	        feedService.showRegSheetFormPage(new AsyncCallback<RegSheet>() {  
	            @Override  
	            public void onFailure(Throwable caught) {  
	                Info.display("RSSReader", "Unable to create a new feed");  
	            }  
	      
	            @Override  
	            public void onSuccess(RegSheet sheed) {  
	                final Window rSheetWindow = new RegSheetWindow(sheed);  
	                rSheetWindow.show();  
	            }  
	        });  
	}
}
